package gestores;


import java.awt.Toolkit;
import java.sql.SQLException;

import javax.swing.JOptionPane;


public class GestorErrores extends Exception{


	private static final long serialVersionUID = 1L;

	private static GestorErrores gError= new GestorErrores();

    static public GestorErrores getGestorErrores() {

        if (gError == null) {
            gError = new GestorErrores();
        }
        return gError;
    }
    
	public int mostrarCartelConsulta(String pregunta,String titulo,String[] botones){

		int n = JOptionPane.showOptionDialog(null,
		    pregunta,
		    titulo,
		    JOptionPane.YES_NO_CANCEL_OPTION,
		    JOptionPane.QUESTION_MESSAGE,
		    null,
		    botones,
		    botones[botones.length-1]);
		//retorna el numero d boton.. comienza en cero
		return n;
	}
	
	public void mostrarCartelError(String error){
		Toolkit.getDefaultToolkit().beep();
		JOptionPane.showMessageDialog(null, error,"Error", JOptionPane.ERROR_MESSAGE);	
	}

	
	public void mostrarCartelAdvertencia(String error){
		Toolkit.getDefaultToolkit().beep();
		JOptionPane.showMessageDialog(null, error,"Felicitaciones", JOptionPane.INFORMATION_MESSAGE);	
	}
	
	
	
}
